package com.hdl.servlet.user;

   

import javax.servlet.annotation.WebServlet;

import com.hdl.R;
import com.hdl.dto.UserSearch;
import com.hdl.entity.HdlUser;
import com.hdl.service.RoleService;
import com.hdl.service.UserService;
import com.hdl.service.impl.RoleServiceImpl;
import com.hdl.service.impl.UserServiceImpl;

@WebServlet("/admin/user.let")
public class HdlUserServlet extends HttpServletSupport{
	private UserService user=new UserServiceImpl();
	private RoleService role=new RoleServiceImpl();
	private  HdlUser qq=new HdlUser();
	
	public Object  page(UserSearch search) throws Exception{
	
		search.setHdlUserid(search.getSysRoleId());
//		System.out.println(search.toString());
		return user.page(search);
	}
	public Object delete (HdlUser use) throws Exception{
		
		 user.delete(use.getHdlUserId());
		 return R.ok();
	}
	public  Object listRole()throws Exception{
		return role.selectByMode();
	}
	//重置密码
	public Object updatePwd(HdlUser use)throws Exception{
		
		qq=user.get(use.getHdlUserId());
		qq.setHdlUserPsd("12345");
				user.update(qq);
	
				return R.ok();
	}
	//查找用户
	public Object select(String hdlUserId)throws Exception{
// 
		hdlUserId="12";
		return user.get(hdlUserId);
	
	}
	
	
	
	

}
